package com.peng.servlet;

import com.peng.entity.work;
import com.peng.service.impl.workServiceImpl;
import com.peng.service.workService;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * Created by 欧阳欣鹏 on 2018/8/7.
 */
public class WorkIndexServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        request.setCharacterEncoding("utf-8");
        int status=0;
        int workType=0;
        if (request.getParameter("status")!=null){

            status=Integer.parseInt(request.getParameter("status"));

        }
        if (request.getParameter("workType")!=null){

            workType=Integer.parseInt(request.getParameter("workType"));
        }
        workService w=new workServiceImpl();
        List<work> li=w.li(status,workType);
        request.setAttribute("li",li);
        request.setAttribute("aid",request.getParameter("aid"));
        request.getRequestDispatcher("admin-list.jsp").forward(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request,response);
    }
}
